package com.phrp.controller;

import com.phrp.entity.vo.ApplyRecordSearchDataVo;
import com.phrp.service.HouseRecordService;
import com.phrp.util.returnResult.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ssc
 * @since 2024-04-20
 */
@RestController
@RequestMapping("/houseRecord")
public class HouseRecordController {

    @Autowired
    private HouseRecordService houseRecordService;

    /**
     * 获取租用申请的信息
     * 根据条件搜索记录
     * @param searchData
     * @return
     */
    @PostMapping(value = "searchRentalApply")
    public ResponseResult searchRentalApply(@RequestBody ApplyRecordSearchDataVo searchData){
        return houseRecordService.searchRentalApply(searchData);
    }

    /**
     * 修改申请状态
     * 修改处理结果
     * @param id
     * @param type
     * @return
     */
    @GetMapping(value = "changeApplyResult")
    public ResponseResult changeApplyResult(@RequestParam String id,@RequestParam String type){
        return houseRecordService.changeApplyResult(id,type);
    }

    /**
     * 获取申请信息
     * @params id
     * @return
     */
    @GetMapping(value = "getApplyData")
    public ResponseResult getApplyData(@RequestParam String id){
        return houseRecordService.getRentalApplyData(id);
    }

    /**
     * 获取退租申请的数据
     * @param searchData
     * @return
     */
    @PostMapping(value = "searchLeaseApply")
    public ResponseResult searchLeaseApply(@RequestBody ApplyRecordSearchDataVo searchData){
        return houseRecordService.searchLeaseApply(searchData);
    }

    /**
     * 获取退租申请详情
     * @param id
     * @return
     */
    @GetMapping(value = "searchLeaseData")
    public ResponseResult searchLeaseData(@RequestParam String id){
        return houseRecordService.searchLeaseData(id);
    }

}
